<?php


namespace app\model;

use think\Model;

class ViidDevice extends Model {

    public function calLabels($labels){
        $labels=explode(',',$labels);
        foreach ($labels as $label) {
            $where[] = ['label_ids','find in set',$label];
            $count=$this->where($where)->count();
            Label::where('id',$label)->save(['label_num'=>$count]);
        }
    }

}